package com.wfh.service;

import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.wfh.model.dto.AppAddRequest;
import com.wfh.model.dto.AppQueryRequest;
import com.wfh.model.entity.App;
import com.wfh.model.entity.User;
import com.wfh.model.vo.AppVO;
import jakarta.servlet.http.HttpServletRequest;
import reactor.core.publisher.Flux;

import java.util.List;

/**
 * 应用 服务层。
 *
 * @author wangfenghuan
 */
public interface AppService extends IService<App> {

    /**
     * 获取appvo
     *
     * @param app
     * @return
     */
    AppVO getAppVO(App app);

    /**
     * 添加应用
     * @param request
     * @return
     */
    Long addApp(AppAddRequest appAddRequest, HttpServletRequest request);

    String chatToGenCode(Long appId, String prompt, User loginUser);

    /**
     * 获取appvo列表
     *
     * @param apps
     * @return
     */
    List<AppVO> getAppVOList(List<App> apps);


    /**
     * 获取查询条件
     *
     * @param appQueryRequest
     * @return
     */
    QueryWrapper getQueryWrapper(AppQueryRequest appQueryRequest);

    /**
     * 生成代码
     * @param appId
     * @param prompt
     * @param loginUser
     * @return
     */
    Flux<String> chatToGenCodeFlux(Long appId, String prompt, User loginUser);

    /**
     * 应用部署
     *
     * @param appId
     * @param loginUser
     * @return
     */
    String deploy(Long appId, User loginUser);


}
